package com.group.transaction.controller;

import com.alibaba.fastjson.JSONObject;
import com.group.transaction.aspect.InMethod;
import com.group.transaction.domain.Logistics;
import com.group.transaction.model.ResultJson;
import com.group.transaction.service.logistics.LogisticsService;
import lombok.Data;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Data
@RequestMapping("/logistics")
public class LogisticsController {

    @Resource
    private LogisticsService logisticsService;

    /**
     * 添加物流
     * @param logistics
     * @return
     */
    @PostMapping("/addLogistics")
    @InMethod(apiName = "添加物流")
    public ResultJson addLogistics (@RequestBody Logistics logistics) {
        return logisticsService.addLogistics(logistics);
    }
    /**
     * 查询全部物流
     * @param logistics
     * @return
     */
    @GetMapping("/queryLogisticsAllData")
    @InMethod(apiName = "查询全部物流")
    public JSONObject queryLogisticsAllData (Logistics logistics) {
        return logisticsService.queryLogisticsAllData(logistics);
    }
    /**
     * 保存寄件信息
     * @param logistics
     * @return
     */
    @PostMapping("/saveLogisticsData")
    @InMethod(apiName = "保存寄件信息")
    public ResultJson saveLogisticsData (@RequestBody Logistics logistics) {
        return logisticsService.saveLogisticsData(logistics);
    }
    /**
     * 查询客户寄的单数
     * @param
     * @return
     */
    @GetMapping("/queryLogisticsCountTotal")
    @InMethod(apiName = "查询客户寄的单数")
    public ResultJson queryLogisticsCountTotal () {
        return logisticsService.queryLogisticsCountTotal();
    }
    /**
     * 查询客户寄的单数
     * @param
     * @return
     */
    @GetMapping("/queryLogisticsDataById")
    @InMethod(apiName = "根据物流id查询物流信息")
    public ResultJson queryLogisticsDataById (Long id) {
        return logisticsService.queryLogisticsDataById(id);
    }
}
